/*
 *  GameMeshes.h
 *  c_Render
 *
 *  Created by liao peterson on 11/8/09.
 *  Copyright 2009 uestc. All rights reserved.
 *
 */
#ifndef MESHES_H__
#define MESHES_H__

#include"Macros.h"
#include"Mathutilis.h"
#include"DataStructures.h"
#include"DataStructures.cpp"
class Mesh{
public:
	GLint		vertexCount;
	GLint		triangleCount;
	GLint		indexCount;
	
	GLint		texWidth;
	GLint		texHeight;
	GLint		texEnable;
	GLint		frameNumber;
	GLfloat		**vertexArray;
	GLfloat		**normalArray;
	GLfloat		*currentVertex;
	GLfloat		*currentNormal;
	GLfloat		*uv;
	GLubyte		*textureData;
	GLchar		*filename;
	GLint		nameLength;
	
	vec3		loc;
	GLfloat		*dir;
	GLfloat		*size;
	GLfloat		*axis;
	GLfloat		alpha;
	Quat		*quat;
	Matrix4x4	*Model2World;
	//For physical purposes
#ifdef PHYSICS_MODE
	Matrix4x4	*trans;
	Matrix4x4	*rot;
	Matrix4x4	*scale;
	// Inverse transforms.
	Matrix4x4	*itrans;
	Matrix4x4	*irot;
	Matrix4x4	*iscale;
#endif
	
	Mesh();
	~Mesh();
	void SetMatrix();
	void SetMatrix(const GLfloat*pos,const GLfloat*ori,const GLfloat*scale);
	void LoadTexture(GLchar*Name);
};


class Meshes{
public:
	List<Mesh>	*mList;
	GLuint		*textureIds;
	GLint		frameNumber;
	GLint		*frames;
	GLint		currentFrame;
	GLfloat		fps;
	GLint		tick;
	
	Meshes();
	~Meshes();
	void LoadMeshes(char*);
	void Animate();
};

#endif